<template>

    <div class="toolbar tabbar tabbar-labels tabbar-button">
        <div class="toolbar-inner toolbar-inner-green">
            <a href="#" class="button button-row-whrite button-full-box" @click="navTo(nextState.pageName)">{{ item.name }}</a>
        </div>
    </div>

</template>


<script type="text/javascript">

    import store from '../store/index'
    export default{
        name: "toolbar",
        props:{
            item:{
                type:Object,
                default:function(){
                    return {
                        name:'退出登录'
                    }
                }
            },
            nextState:{
                type:Object,
                default:function(){
                    return {
                        pageName:'login-page', 
                    }
                }
            }
        },
        methods: {
            navTo (pageName) {
                if ( pageName != this.currentPageName) {
                    if ($$("#" + pageName).length > 0) {
                        mainView.router.back({
                            pageName: pageName,
                            animatePages: false,
                            pushState: false,
                            force: true
                        });
                    }
                    else {
                        myApp.redictNewPage(pageName, true, true, true, true)
                    }
                }
            },

        },
        computed: {
            currentPageName () {
                return store.state.current.pageName
            }
        }

    }

</script>
